﻿using AVCUMPlatform.BLL.Interface;
using AVCUMPlatform.DAL.Implement;
using AVCUMPlatform.DAL.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVCUMPlatform.BLL.Implement
{
    public abstract partial class BaseBLL<T> where T : class, new()
    {
        public BaseBLL()
        {
            SetDal();
        }

        public IBasDAL<T> Dal { get; set; }

        public abstract void SetDal();

        public bool Add(T t)
        {
            return Dal.Add(t);
        }
        public bool Delete(List<int> ids)
        {
            return Dal.Delete(ids);
        }
        public int AddReturnAutoId(T t)
        {
            return Dal.AddReturnAutoId(t);
        }
        public bool Update(T t)
        {
            return Dal.Update(t);
        }

        public T Get(int id)
        {
            return Dal.Get(id);
        }

        public List<T> GetList(out int count, int page = 1, int per_page = 20)
        {
            return Dal.GetList(out count, page, per_page);
        }

        public List<T> GetAll()
        {
            return Dal.GetAll();
        }
    }
}
